﻿using System;
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using PathologicalGames;
using UnityEngine;

public abstract class SkillBase : MonoBehaviour
{
    
    public ushort skillId;
    protected ParticleSystem MyPar;
    protected Transform MyTran;

    protected Tween moveTween;
    public Action TweenEndAction;

    protected virtual void Awake()
    {
        MyTran = transform;
        MyPar = GetComponent<ParticleSystem>();
        TweenEndAction += () =>
        {
            MyPar.Stop();
            Recycle();
        };
    }

    /// <summary>
    /// 释放技能 
    /// </summary>
    /// <param name="pos">释放位置</param>
    /// <param name="dir">释放方向</param>
    /// <param name="moveDuration">释放时长</param>
    public abstract void Release(Vector3 pos,Vector3 dir,float moveDuration);

    /// <summary>
    /// 取消技能
    /// </summary>
    public abstract void DisableSkill();


    public virtual void Recycle()
    {
        SkillPoolManager._instance.DespawnInstance(transform);
    }
}
